package com.cib.process.chat.core.handler.impl;

import com.cib.process.bean.CheckType;
import com.cib.process.bean.ServiceResult;
import com.cib.process.chat.bean.Completekey;
import com.cib.process.chat.bean.NumericLetterResult;
import com.cib.process.chat.bean.PlayType;
import com.cib.process.chat.bean.QueryResult;
import com.cib.process.chat.core.handler.ActionHandler;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;

/**
 * 1001 处理数字字母
 */
@Service
public class NumericLetterActionHandler implements ActionHandler {
    /*
    *  注意这里的输入长度和CVV2的区别
    * */
    @Value("${action.1001.result.minkey:0}")
    private String minkey;
    @Value("${action.1001.result.maxkey:20}")
    private String maxkey;
    @Value("${action.1001.result.numberflag:N}")
    private String numberflag;
    @Value("${action.1001.result.canbreak:N}")
    private String canbreak;
    @Value("${action.1001.result.recordflag:N}")
    private CheckType recordflag;
    @Value("${action.1001.result.poundflag:Y}")
    private String poundflag;

    @Override
    public ServiceResult execute(QueryResult queryResult) {
        NumericLetterResult result=new NumericLetterResult();
        result.setCompletekey(Completekey.NUM.getCode());
        result.setContext(queryResult.getSuggestAnswer());
        result.setMaxkey(maxkey);
        result.setMinkey(minkey);
        result.setType(PlayType.TTS);
        result.setCanbreak(canbreak);
        result.setPoundflag(poundflag);
        result.setRecordflag(recordflag);

        //数字卡号等不需要屏蔽
        result.setMessageflag("N");

        return ServiceResult.buildSuccessResult(result,queryResult.getSessionId(),queryResult.getAction());
    }
}
